package com.hfzy.ihk.facade.linkcall.enums;

import com.hfzy.ihk.common.facade.CustomEnumType;

import java.util.HashMap;
import java.util.Map;

public enum Bool implements CustomEnumType {
	TRUE("true", "是"),
	FALSE("false", "否");

	private Bool(String value, String desc) {
		this.value = value;
		this.desc = desc;
	}

	private String value;

	private String desc;

	@Override
	public String getValue() {
		return value;
	}

	@Override
	public String getDesc() {
		return desc;
	}

	private static Map<String, Bool> map = new HashMap<>();
	static {
		for (Bool value : Bool.values()) {
			map.put(value.getValue(), value);
		}
	}

	public static Bool fromValue(String value) {
		Bool ret = map.get(value);
		if (ret != null) {
			return ret;
		} else {
			throw new IllegalArgumentException("No enum const " + Bool.class + "." + value);
		}
	}
}
